/*
 * @Author: 灰佳小白 1150248441@qq.com
 * @Date: 2022-10-13 20:05:24
 * @LastEditors: 灰佳小白 1150248441@qq.com
 * @LastEditTime: 2022-10-16 18:42:49
 * @FilePath: \briup-ui\src\store\modules\category.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { findCategory } from '@/api/infoCategory'
export default {
  namespaced: true,
  state: {
    // 所有栏目数据
    categories: []
  },
  mutations: {
    // 声明栏目突变
    SET_CATEGORY(state, payload) {
      state.categories = payload
    }
  },
  actions: {
    // 查询所有栏目 api
    async queryCategories({ commit }) {
      const res = await findCategory()
      // console.log(res);
      commit('SET_CATEGORY', res.data)
    }
  }

}
